home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / amos / amoslist-0295.lzh / AMOSLIST / text0092.txt < prev    next >
Encoding:
Text File  |  1995-03-01  |  3.7 KB  |  91 lines

  1.  
  2. Sorry for my english... but I'll try to make things clear.
  3.  
  4. After an intensive discussion with other two physicist i found the answer 
  5. to the elastic collision question.
  6. I assume that the masses of the cars are all equal for semplicity.
  7.  
  8. Avoiding friction forces and however every kind of dissipative forces, 
  9. what really is important is the momentum conservation and the kinetics 
  10. energy.
  11. Now the result is that after an elastic collision between two boby of the 
  12. same mass, their velocity is simply exchanged. You can see this with a 
  13. billiard ball which strikes a static ball. After the collision the first 
  14. "incoming" ball come to rest while the second escape with the velocity of 
  15. the first ball. On a head on collision where both the ball move the 
  16. second ball return with the velocity of the first and the first with the 
  17. velocity of the second.
  18. So it mat all seem simple... but... what happen if it is not a head on 
  19. collision? This is the problem (to be or not to be... ehmm...). 
  20.  
  21. The problem is more evident if your car are rectangular. In this case 
  22. (excluding rotation movement, in which case you would need a second of 
  23. your computer power to calculate the resulting movements!) the machines 
  24. can collide also on sides.
  25.  
  26. You should have four lines on each car which detect where the collision  
  27. happens. This way you can easily calculate the relative velocity (that 
  28. on axe X or on axe Y depending on the point of collision) which the car 
  29. takes from the other car.
  30.  
  31. So if you have a car which is moving north (1) and one which is moving west 
  32. (2) and they collide you have to decide which is the "incoming" and which is 
  33. the "target". This is easy... the "incoming" car is that which hits with 
  34. the front of the car, while the "target" is that which is hit on the 
  35. side or the back. 
  36.  
  37. Assume the car (2) is the "incoming" car and collide with (1).
  38. (1) is hit on the right side, while (2) hit with the front.
  39. Now car (2) stops moving completely (as there is not X velocity coming 
  40. from car (1) ) while car (1) acquires the x velocity of car (2).
  41.  
  42. You can apply friction after the collision which simply slow down car (1) 
  43. skidding.
  44.  
  45. The base formula of the collision is:
  46.  
  47.         V1i+V2i = V1f+V2f
  48.  
  49. This means that the sum of the velocity before the collision and the 
  50. sum of the resulting velocities after the collision are the same.
  51.  
  52. All the example I have made follow this rule.
  53.  
  54. Now friction.
  55. It is very simple as a formula, but i think it is quite complicated to 
  56. insert in your game.
  57. If the cars are not subjected to an acceleration in a determined 
  58. direction they must slow down on that direction. So after a head-side 
  59. collision car (2) must slow down it's velocity on axe X.
  60.  
  61. Friction formula is:
  62.             F=-kM 
  63. where M is the mass of the car and K a coefficient which determines the 
  64. strenght of the force. 
  65. You should have two friction forces. One for the back-front direction of 
  66. the car  and one for the left-right side direction of the car. 
  67. The former should be smaller than the latter as the wheels help the car 
  68. while the side movement are much more "dumped".
  69. The side force can be 20 times stronger than the back-head force.
  70.  
  71. You can easily use the collision formulae for a car against a wall 
  72. (letting the wall be completely rigid). The car simply is "reflected" by 
  73. the wall. This follows the energy conservation rule.
  74.  
  75. If you want to include car deformation you have to add a coefficient to 
  76. the equations exchanging the velocity of the colliding objects.
  77. The coefficient should be a number < 1.
  78.  
  79. This seems quite complicated, but I think it is not. Maybe the most 
  80. difficult things is to trace the 4 lines on the cars which control 
  81. collisions.
  82.  
  83. Hope this vill help.
  84.  
  85. M&F
  86.  
  87. P.S. Sorry for my english, but if you could not understand something tell 
  88. me. I will try to make it clearer.
  89.  
  90.  
  91.